home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 August: Tool Chest / Dev.CD Aug 94.toast / Sample Code / Newton Sample Code 1.1 / Proto Templates / Shell Game-2 / shellGame.π.text < prev    next >
Encoding:
Text File  |  1994-02-28  |  4.0 KB  |  166 lines  |  [TEXT/MPS ]

  1.  
  2. // ---- End Project Data ----
  3.  
  4.  
  5. // ---- File main.t ----
  6. myBase :=
  7.    {title: "Shell Game",
  8.     viewBounds: {left: -1, top: 64, right: 233, bottom: 282},
  9.     _proto: protoApp,
  10.     debug: "myBase"
  11.    };
  12.  
  13. shellOne := /* child of myBase */
  14.    {
  15.     viewSetupFormScript:
  16.       func()
  17.       begin
  18.           self.target := self;
  19.           //call this after setting up the lines array
  20.           inherited:?viewSetupFormScript()
  21.       end,
  22.     flushEdits:
  23.       func()
  24.       begin
  25.           nil
  26.       end,
  27.     lines:
  28.       [{_proto: protoTextExpando,
  29.           label: "Override",
  30.           path: 'deleteThis,
  31.           entryFlags: (1 << 0)  + (65535 << 9)},
  32.       {_proto: protoTextExpando,
  33.           label: "Override",
  34.           path: 'deleteThis,
  35.           entryFlags: (1 << 0)  + (65535 << 9)},
  36.           {_proto: protoTextExpando,
  37.           label: "These",
  38.           path: 'deleteThis,
  39.           entryFlags: (1 << 0)  + (65535 << 9)}],
  40.     numlines: 3,
  41.     editWidth: 110,
  42.     editHeight: 50,
  43.     deleteThis: "delete",
  44.     viewBounds: {left: 3, top: 27, right: 118, bottom: 190},
  45.     indent: 50,
  46.     viewClickScript:
  47.       func(unit)
  48.       begin
  49.          // call the inherited script for proper behavior
  50.          inherited:?viewClickScript(unit);
  51.       
  52.          // the inherited call correctly sets the split
  53.          // variable to the currently open item
  54.          // use that to expand the line on the other expando.
  55.          // Note that you have to send the redoChildren message
  56.          // to update the other expando
  57.          shellTwo:ExpandLine(split);
  58.          shellTwo:RedoChildren();      
  59.       end,
  60.     fromTwo: nil,
  61.     DoExpandNone:
  62.       func()
  63.       begin
  64.          // first call the inherited method to do the right thing
  65.          inherited:ExpandNone();
  66.       
  67.          // now check if I need to close the expanded item
  68.          // use the sync variable that the other shell will set
  69.          if not fromTwo then
  70.          begin
  71.             shellTwo.fromOne := true ;
  72.             shellTwo:ExpandNone();
  73.          end;
  74.          else
  75.             fromTwo := nil ;
  76.       end,
  77.     ExpandNone:
  78.       func()
  79.       begin
  80.          // since this gets called with a bum context due to
  81.          // an AddDeferredAction, you need to send a message
  82.          // to the shell directly so that it can do an
  83.          // inherited call of the ExpandNone message.
  84.          // see DoExpandNone...
  85.          shellOne:DoExpandNone();
  86.       end,
  87.     _proto: protoExpandoShell,
  88.     debug: "shellOne"
  89.    };
  90. // View shellOne is declared to myBase
  91.  
  92.  
  93.  
  94. shellTwo := /* child of myBase */
  95.    {
  96.     viewSetupFormScript:
  97.       func()
  98.       begin
  99.           self.target := self;
  100.           //call this after setting up the lines array
  101.           inherited:?viewSetupFormScript()
  102.       end,
  103.     flushEdits:
  104.       func()
  105.       begin
  106.           nil
  107.       end,
  108.     lines:
  109.       [{_proto: protoTextExpando,
  110.           label: "Override",
  111.           path: 'deleteThis,
  112.           entryFlags: (1 << 0)  + (65535 << 9)},
  113.       {_proto: protoTextExpando,
  114.           label: "Override",
  115.           path: 'deleteThis,
  116.           entryFlags: (1 << 0)  + (65535 << 9)},
  117.           {_proto: protoTextExpando,
  118.           label: "These",
  119.           path: 'deleteThis,
  120.           entryFlags: (1 << 0)  + (65535 << 9)}],
  121.     numlines: 3,
  122.     editWidth: 110,
  123.     editHeight: 50,
  124.     deleteThis: "delete",
  125.     viewBounds: {left: 120, top: 27, right: 235, bottom: 190},
  126.     indent: 50,
  127.     viewClickScript:
  128.       func(unit)
  129.       begin
  130.          inherited:?viewClickScript(unit);
  131.       
  132.          shellOne:ExpandLine(split);
  133.          shellOne:RedoChildren();      
  134.       end,
  135.     fromOne: nil,
  136.     DoExpandNone:
  137.       func()
  138.       begin
  139.          inherited:ExpandNone();
  140.          if not fromOne then
  141.          begin
  142.             shellOne.fromTwo := true ;
  143.             shellOne:ExpandNone();
  144.          end;
  145.          else
  146.             fromOne := nil ;
  147.       end,
  148.     ExpandNone:
  149.       func()
  150.       begin
  151.          shellTwo:DoExpandNone();
  152.       end,
  153.     _proto: protoExpandoShell,
  154.     debug: "shellTwo"
  155.    };
  156. // View shellTwo is declared to myBase
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164. // ---- Beginning of section for non used Layout files ----
  165.  
  166. // End of output